<?php
/**
* エラーチェッククラス
**/
require_once( '../system/Class_M_DAO.php' );
class t_m_delivery extends Class_M_DAO {
	
	//protected properties begin
	/**
	 *
	 * テーブル名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_table = "d_delivery";
	
	/**
	 *
	 * 主キー名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_pkey = "sent_id";
	
	/**
	 *
	 * ソート順
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	 protected $_order = "sent_id";
	 
	 protected $_cols  = array(
	 	"sent_id"           => array(ECJP_VARTYPE_INT),
		"login_id"              => array(ECJP_VARTYPE_STR),
		"sent_name"      => array(ECJP_VARTYPE_STR),
	    "sent_name1"      => array(ECJP_VARTYPE_STR),
		"sent_name2"   => array(ECJP_VARTYPE_STR),
	    "sent_workshop_name1"      => array(ECJP_VARTYPE_STR),
	    "sent_workshop_name2"         => array(ECJP_VARTYPE_STR),
	    "sent_name_furikana1"           => array(ECJP_VARTYPE_STR),
	    "sent_name_furikana2"     => array(ECJP_VARTYPE_STR),
	    "sent_dep"         => array(ECJP_VARTYPE_STR),
	    "sent_zipcode"      => array(ECJP_VARTYPE_STR),
	    "sent_local_cd"   => array(ECJP_VARTYPE_STR),
	    "sent_treet_name"            => array(ECJP_VARTYPE_STR),
	    "sent_address"             => array(ECJP_VARTYPE_STR),
	    "sent_tel_number"        => array(ECJP_VARTYPE_STR),
	   
	  
	 );
/*
define("CHK_EXIST",     1);
define("CHK_NUM",       2);
define("CHK_LEN",       3);
define("CHK_MAX",       4);
define("CHK_ALNUM",     5);//半角英数チェック 
define("CHK_TEL",       6);
define("CHK_EMAIL",     7);
define("CHK_URL",       8);
define("CHK_KATAKANA",  9);
define("CHK_HIRAKANA",  10);
define("CHK_YMD",       11);
define("CHK_PLATFORM",  12);//機種依存文字チェック
define("CHK_ZIP",       13);
 */

	 protected $_checks  = array(
		"login_id"             => array( CHK_EXIST ,CHK_ALNUM ),
		"sent_workshop_name1"            => array( CHK_EXIST ,CHK_ALNUM),
		"sent_name1"  => array( CHK_EXIST ,CHK_ALNUM),
		"sent_name2"  => array( CHK_EXIST ,CHK_ALNUM),
		"sent_id"             => array( CHK_NUM ),
		
	 );
	 
	 //maxlength 
	 protected $_maxlens  = array(
		"login_id"   =>  20 ,
		"sent_name1"  =>  50 ,
		"sent_name2"       =>  50 ,
		"sent_id"      =>  11 
	 );
	
	 public function search($where='' ,&$page = NULL ){	
		$sql = "SELECT *  FROM ".$this->_table;
		$sqlcnt = "SELECT COUNT(*) AS cnt FROM ".$this->_table;
		return  parent::search($where ,$page ,$sql,$sqlcnt);
	}
	 /*
	 public function get_rows(){
	 	$sql = "SELECT  * FROM {$this->_table}";
	 	return parent::get_rows($sql);
	 	
	 }
	 */
	 public function search_csv($where){	
	    $sql = "SELECT * FROM ".$this->_table;
		$page = null;
		return  parent::search($where ,$page ,$sql);
	}
	
}

?>